
<%@ include file="../common/top.jsp" %>

<div id="BackLink">
    <a href="main">Return to Main Menu</a>
</div>

<%--<div id="Cartlog">--%>
<%--    <div id="Cart">--%>
<%--        <h2>Shopping Cart</h2>--%>

<%--        <form action="updateCart?record=<%="update the cart:"%>" method="post">--%>
<%--            <table>--%>
<%--                <tr>--%>
<%--                    <th><b>Item ID</b></th>--%>
<%--                    <th><b>Product ID</b></th>--%>
<%--                    <th><b>Description</b></th>--%>
<%--                    <th><b>In Stock?</b></th>--%>
<%--                    <th><b>Quantity</b></th>--%>
<%--                    <th><b>List Price</b></th>--%>
<%--                    <th><b>Total Cost</b></th>--%>
<%--                    <th>&nbsp;</th>--%>
<%--                </tr>--%>

<%--                <c:if test="${sessionScope.cart.numberOfItems == 0}">--%>
<%--                    <tr>--%>
<%--                        <id colspan="8"><b>Your cart is empty</b></id>--%>
<%--                    </tr>--%>
<%--                </c:if>--%>

<%--                <c:forEach var="cartItem" items="${sessionScope.cart.cartItems}">--%>
<%--                    <tr>--%>
<%--                        <td>--%>
<%--                            <a href="itemForm?itemId=${cartItem.item.itemId}&record=<%="Look at item:"%>">${cartItem.item.itemId}</a>--%>
<%--                        </td>--%>
<%--                        <td>${cartItem.item.product.productId}</td>--%>
<%--                        <td>${cartItem.item.attribute1} ${cartItem.item.attribute2}--%>
<%--                                ${cartItem.item.attribute3} ${cartItem.item.attribute4}--%>
<%--                                ${cartItem.item.attribute5} ${cartItem.item.product.name}</td>--%>
<%--                        <td>${cartItem.inStock}</td>--%>
<%--                        <td>--%>
<%--                            <input type="text" name="${cartItem.item.itemId}" value="${cartItem.quantity}">--%>
<%--                        </td>--%>
<%--                        <td><fmt:formatNumber value="${cartItem.item.listPrice}"--%>
<%--                                              pattern="$#,##0.00" /></td>--%>
<%--                        <td><fmt:formatNumber value="${cartItem.total}"--%>
<%--                                              pattern="$#,##0.00" /></td>--%>
<%--                        <td>--%>
<%--                            <a href="removeCartItem?workingItemId=${cartItem.item.itemId}&record=<%="remove item from cart:"%>" class="Button">Remove</a>--%>
<%--                        </td>--%>
<%--                    </tr>--%>
<%--                </c:forEach>--%>
<%--                <tr>--%>
<%--                    <td colspan="7">--%>
<%--                        Sub Total:<fmt:formatNumber--%>
<%--                            value="${sessionScope.cart.subTotal}" pattern="$#,##0.00" />--%>
<%--                        <input type="submit" value="Update Cart">--%>
<%--                    </td>--%>

<%--                    <td>&nbsp;</td>--%>
<%--                </tr>--%>
<%--            </table>--%>
<%--        </form>--%>



<%--        <c:if test="${sessionScope.cart.numberOfItems > 0}">--%>
<%--            <a href="newOrderForm" class="Button">Proceed to checkOut</a>--%>
<%--        </c:if>--%>
<%--    </div>--%>

<%--    <div id="MyList">--%>
<%--        <c:if test="${sessionScope.loginAccount != null}">--%>
<%--            <c:if test="${!sessionScope.loginAccount.listOption}">--%>
<%--                <%@include file="includeMyList.jsp"%>--%>
<%--            </c:if>--%>
<%--        </c:if>--%>
<%--    </div>--%>

<%--    <div id="Separator">&nbsp;</div>--%>
<%--</div>--%>
<div class="crumb">
    <div class="w">
        <div class="crumb-content">
            <a href="main" class="link">MyStore</a>
            <span>></span>
            <span class="link-text">My Cart</span>
        </div>
    </div>
</div>

<div class="page-wrap w">
    <div class="panel">
        <div class="panel-title">Shopping Cart</div>
            <div class="panel-body">
                <table class="product-table">
                    <tr>
<%--                        &nbsp;--%>
                        <th class="cell-img">Item Picture</th>
                        <th class="cell-id">Item ID</th>
                        <th class="cell-info">Description</th>
                        <th class="cell-price">Price</th>
                        <th class="cell-count">Quantity</th>
                        <th class="cell-total">Total price</th>
                        <th class="cell-operator">Operate</th>
                    </tr>
    <%--                每个商品内容--%>
                    <c:forEach var="cartItem" items="${sessionScope.cart.cartItems}">
                        <tr>
                            <td class="cell-img">
                                <div class="link">
                                <%--  图片内容,可能需要修改  --%>
                                        ${cartItem.item.product.description}
<%--                                    <img class="product-img" src="${cartItem.item.product.description}" alt="">--%>
                                </div>
                            </td>
                            <td class="cell-id">
                                <a class="link" href="itemForm?itemId=${cartItem.item.itemId}&record=<%="Look at item:"%>">
                                    ${cartItem.item.itemId}
                                </a>
                            </td>
                            <td class="cell-info">
                                <a href="#" class="link">
                                    ${cartItem.item.attribute1} ${cartItem.item.attribute2}
                                    ${cartItem.item.attribute3} ${cartItem.item.attribute4}
                                    ${cartItem.item.attribute5} ${cartItem.item.product.name}
                                </a>
                            </td>
                            <td class="cell-price">
                                <div class="single-price">
                                    <fmt:formatNumber value="${cartItem.item.listPrice}"
                                                      pattern="$#,##0.00" />
                                </div>
                            </td>
                            <td class="cell-count">
<%--                                <div class="op-minus">-</div>--%>
                                <div class="op minus">-</div>
                                    <div class="count-num">${cartItem.quantity}</div>
                                <div class="op add">+</div>
                                <div class="judge_Msg"></div>
<%--                                <div class="op-plus">+</div>--%>
                            </td>
                            <td class="cell-total">
                                <fmt:formatNumber value="${cartItem.total}"
                                                  pattern="$#,##0.00" />
                            </td>
                            <td class="cell-operator">
                                <div class="link">Delete</div>
                            </td>
                        </tr>
                    </c:forEach>
                </table>
                <div class="submit-content">
                    <span>sum:</span>
                    <span class="total-price">
                    <%--  可能这里不会再用format,会用js增加事件监听器来计算总价  --%>
                        <fmt:formatNumber value="${sessionScope.cart.subTotal}"
                                          pattern="$#,##0.00" />
                    </span>
                    <a href="newOrderForm" class="btn order-submit">settle account</a>
                </div>
                <h2 id="information" style="text-align:center">Your cart is empty!</h2>
            </div>
      </div>
</div>
<script src="js/cart.js"></script>
<%@ include file="../common/bottom.jsp" %>